package com.yanqu.road.entity.activity.ppl;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.ArrayList;
import java.util.List;

/**
 * 泡泡龙用户数据
 */
@FieldTypeAnnotation(tableName = "t_u_activity_ppl")
public class PplUserData extends DataObject {

    @FieldTypeAnnotation(desc = "用户ID", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "美女ID")
    private int beautyId;

    @FieldTypeAnnotation(desc = "首个颜色（用于生成下一行）1倍")
    private int headColor1;
    @FieldTypeAnnotation(desc = "首个颜色（用于生成下一行）4倍")
    private int headColor4;
    @FieldTypeAnnotation(desc = "首个颜色（用于生成下一行）16倍")
    private int headColor16;

    @FieldTypeAnnotation(desc = "待发射的颜色1倍")
    private int curColor1;
    @FieldTypeAnnotation(desc = "待发射的颜色4倍")
    private int curColor4;
    @FieldTypeAnnotation(desc = "待发射的颜色16倍")
    private int curColor16;

    @FieldTypeAnnotation(desc = "当前最大Y值1倍")
    private int curMaxY1;
    @FieldTypeAnnotation(desc = "当前最大Y值4倍")
    private int curMaxY4;
    @FieldTypeAnnotation(desc = "当前最大Y值16倍")
    private int curMaxY16;

    @FieldTypeAnnotation(desc = "体力")
    private int energy;

    @FieldTypeAnnotation(desc = "体力上次恢复时间")
    private long lastRecoveryTime;

    @FieldTypeAnnotation(desc = "所有球的数据1倍")
    private List<PplLine> pplLineList1;
    @FieldTypeAnnotation(desc = "所有球的数据4倍")
    private List<PplLine> pplLineList4;
    @FieldTypeAnnotation(desc = "所有球的数据16倍")
    private List<PplLine> pplLineList16 = new ArrayList<>();

    @FieldTypeAnnotation(desc = "鼓收集的音符数量")
    private List<Integer> drumList;

    @FieldTypeAnnotation(desc = "积分")
    private int score;

    @FieldTypeAnnotation(desc = "每日积分")
    private int todayScore;

    @FieldTypeAnnotation(desc = "重置时间")
    private long scoreResetTime;

    private int curColor;
    private List<PplLine> pplLineList;
    private int headColor;
    private int curMaxY;

    private int curMultiType = 1; // 当前多倍类型：1一倍，4四倍，3十六倍

    public void setHeadColor1(int headColor1) {
        if (this.headColor1 != headColor1) {
            this.headColor1 = headColor1;
            setUpdateOption();
        }
    }

    public void setHeadColor4(int headColor4) {
        if (this.headColor4 != headColor4) {
            this.headColor4 = headColor4;
            setUpdateOption();
        }
    }

    public void setCurColor1(int curColor1) {
        if (this.curColor1 != curColor1) {
            this.curColor1 = curColor1;
            setUpdateOption();
        }
    }

    public void setCurColor4(int curColor4) {
        if (this.curColor4 != curColor4) {
            this.curColor4 = curColor4;
            setUpdateOption();
        }
    }

    public void setCurMaxY1(int curMaxY1) {
        if (this.curMaxY1 != curMaxY1) {
            this.curMaxY1 = curMaxY1;
            setUpdateOption();
        }
    }

    public void setCurMaxY4(int curMaxY4) {
        if (this.curMaxY4 != curMaxY4) {
            this.curMaxY4 = curMaxY4;
            setUpdateOption();
        }
    }

    public void setPplLineList1(List<PplLine> pplLineList1) {
        this.pplLineList1 = pplLineList1;
        setUpdateOption();
    }

    public void setPplLineList4(List<PplLine> pplLineList4) {
        this.pplLineList4 = pplLineList4;
        setUpdateOption();
    }

    public void setScoreResetTime(long scoreResetTime) {
        if (this.scoreResetTime != scoreResetTime) {
            this.scoreResetTime = scoreResetTime;
            setUpdateOption();
        }
    }

    public void setTodayScore(int todayScore) {
        if (todayScore != this.todayScore) {
            this.todayScore = todayScore;
            setUpdateOption();
        }
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public void setBeautyId(int beautyId) {
        if (this.beautyId != beautyId) {
            this.beautyId = beautyId;
            setOp(DataStatus.Update);
        }
    }

    public void setEnergy(int energy) {
        if (this.energy != energy) {
            this.energy = energy;
            setOp(DataStatus.Update);
        }
    }

    public void setLastRecoveryTime(long lastRecoveryTime) {
        if (this.lastRecoveryTime != lastRecoveryTime) {
            this.lastRecoveryTime = lastRecoveryTime;
            setOp(DataStatus.Update);
        }
    }

    public void setScore(int score) {
        if (this.score != score) {
            this.score = score;
            setOp(DataStatus.Update);
        }
    }

    public void setDrumList(List<Integer> drumList) {
        this.drumList = drumList;
        setOp(DataStatus.Update);
    }

    public void setHeadColor16(int headColor16) {
        if (this.headColor16 != headColor16) {
            this.headColor16 = headColor16;
            setUpdateOption();
        }
    }

    public void setCurColor16(int curColor16) {
        if (this.curColor16 != curColor16) {
            this.curColor16 = curColor16;
            setUpdateOption();
        }
    }

    public void setCurMaxY16(int curMaxY16) {
        if (this.curMaxY16 != curMaxY16) {
            this.curMaxY16 = curMaxY16;
            setUpdateOption();
        }
    }

    public void setPplLineList16(List<PplLine> pplLineList16) {
        if (pplLineList16 == null) {
            return;
        }
        this.pplLineList16 = pplLineList16;
        setUpdateOption();
    }

    public void setCurColor(int curColor) {
        this.curColor = curColor;
    }

    public void setPplLineList(List<PplLine> pplLineList) {
        this.pplLineList = pplLineList;
    }

    public void setHeadColor(int headColor) {
        this.headColor = headColor;
    }

    public void setCurMaxY(int curMaxY) {
        this.curMaxY = curMaxY;
    }

    public long getUserId() {
        return userId;
    }

    public int getActivityId() {
        return activityId;
    }

    public int getBeautyId() {
        return beautyId;
    }

    public int getEnergy() {
        return energy;
    }

    public long getLastRecoveryTime() {
        return lastRecoveryTime;
    }

    public List<Integer> getDrumList() {
        return drumList;
    }

    public int getScore() {
        return score;
    }

    public long getScoreResetTime() {
        return scoreResetTime;
    }

    public int getTodayScore() {
        return todayScore;
    }

    public int getHeadColor1() {
        return headColor1;
    }

    public int getHeadColor4() {
        return headColor4;
    }

    public int getCurColor1() {
        return curColor1;
    }

    public int getCurColor4() {
        return curColor4;
    }

    public int getCurMaxY1() {
        return curMaxY1;
    }

    public int getCurMaxY4() {
        return curMaxY4;
    }

    public List<PplLine> getPplLineList1() {
        return pplLineList1;
    }

    public List<PplLine> getPplLineList4() {
        return pplLineList4;
    }

    public int getCurColor() {
        return curColor;
    }

    public List<PplLine> getPplLineList() {
        return pplLineList;
    }

    public int getHeadColor() {
        return headColor;
    }

    public int getCurMaxY() {
        return curMaxY;
    }

    public int getCurMultiType() {
        return curMultiType;
    }

    public int getHeadColor16() {
        return headColor16;
    }

    public int getCurColor16() {
        return curColor16;
    }

    public int getCurMaxY16() {
        return curMaxY16;
    }

    public List<PplLine> getPplLineList16() {
        return pplLineList16;
    }

    /**
     * 切换倍率
     */
    public void changeMulti(int multiType) {
        if (multiType == 1) {
            this.headColor = this.headColor1;
            this.curColor = this.curColor1;
            this.curMaxY = this.curMaxY1;
            this.pplLineList = this.pplLineList1;
            this.curMultiType = multiType;
        } else if (multiType == 2) {
            this.headColor = this.headColor4;
            this.curColor = this.curColor4;
            this.curMaxY = this.curMaxY4;
            this.pplLineList = this.pplLineList4;
            this.curMultiType = multiType;
        } else if (multiType == 3) {
            this.headColor = this.headColor16;
            this.curColor = this.curColor16;
            this.curMaxY = this.curMaxY16;
            this.pplLineList = this.pplLineList16;
            this.curMultiType = multiType;
        }
    }

    /**
     * 保存当前多倍数据
     */
    public void saveMultiData() {
        if (this.curMultiType == 1) {
            this.headColor1 = this.headColor;
            this.curColor1 = this.curColor;
            this.curMaxY1 = this.curMaxY;
            this.pplLineList1 = this.pplLineList;
        } else if (this.curMultiType == 2) {
            this.headColor4 = this.headColor;
            this.curColor4 = this.curColor;
            this.curMaxY4 = this.curMaxY;
            this.pplLineList4 = this.pplLineList;
        } else if (this.curMultiType == 3) {
            this.headColor16 = this.headColor;
            this.curColor16 = this.curColor;
            this.curMaxY16 = this.curMaxY;
            this.pplLineList16 = this.pplLineList;
        }
        setUpdateOption();
    }
}
